import {z} from 'zod';

const numberListSchema = z.array(z.number())

const stringListSchema = z.array(z.string())


const infoSchema = z.object({
    name: z.string(),
    age:z.number(),
    numberList:numberListSchema,
    roles:z.array(z.object({
        role:z.string(),
        id:z.string(),
    })),
})
const infoListSchema = z.array(infoSchema)

let infoListData = [
    {
        name:'小明',
        age:18,
        numberList:[123,321],
        roles:[
            {
                role:'admin',
                id:'001'
            }
        ]
    }
]
try {
    const result = infoListSchema.parse(infoListData);
    console.log(JSON.stringify(result))
}catch (err){
    console.log(err)
}
